<extend name="Public:base" />
<block name="content">
	<div class="page-header">
		<h1>
			{$breadcrumb2}
			<small>
				<i class="icon-double-angle-right"></i>
				基本信息
			</small>
		</h1>
	</div>
<div class="row">
	<div class="col-xs-12">
		<form class="form-horizontal"  id="form" method="post" action="{:U('Settings/save')}">

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left">网站ICON </label>
				<div class="col-sm-10" id="thumb">
			    <a href="#" data-toggle="image" class="img-thumbnail">
			   		<img osctype="image" <if condition="$site['SITE_ICON']['value']">
									src="__ROOT__/<?php echo resize($site['SITE_ICON']['value'],100,100); ?>"
									<else />
									src="__ROOT__/Common/image/no_image_40x40.jpg"
									</if>  />
					</a>
			    <input osctype="image_input" type="hidden" name="SITE_ICON" value="{$site.SITE_ICON.value|default=''}" id="input-image" />
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left"> * 网站标题 </label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="SITE_TITLE" class="col-xs-10 col-sm-10 form-control"  value="{$site.SITE_TITLE.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left"> * 网站名称 </label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="SITE_NAME" class="col-xs-10 col-sm-10 form-control"  value="{$site.SITE_NAME.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left"> * 网站描述 </label>
				<div class="col-sm-10">
					<div class="clearfix">
						<textarea name="SITE_DESCRIPTION" id="input-meta-description2" class="form-control" rows="5" >{$site.SITE_DESCRIPTION.value|default=''}</textarea>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left"> * 网站关键字 </label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="SITE_KEYWORDS" class="col-xs-10 col-sm-10 form-control"  value="{$site.SITE_KEYWORDS.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label" for="input-tag2">
					网站slogan
				</label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="SITE_SLOGAN" class="col-xs-10 col-sm-10 form-control"  value="{$site.SITE_SLOGAN.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left"> 网址 </label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="SITE_URL" class="col-xs-10 col-sm-10 form-control"  value="{$site.SITE_URL.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left"> 短网址 </label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="SHORT_URL" class="col-xs-10 col-sm-10 form-control"  value="{$site.SHORT_URL.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left">  备案号</label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="SITE_ICP" class="col-xs-10 col-sm-10 form-control"  value="{$site.SITE_ICP.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left">  邮箱</label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="EMAIL" class="col-xs-10 col-sm-10 form-control"  value="{$site.EMAIL.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left">  联系电话</label>
				<div class="col-sm-10">
					<div class="clearfix">
						<input name="TELEPHONE" class="col-xs-10 col-sm-10 form-control"  value="{$site.TELEPHONE.value|default=''}" type="text">
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left"> 站点状态</label>
				<div class="col-sm-10">
					<div class="clearfix">
							<label class="radio-inline"><input <?php if($site['WEB_SITE_CLOSE']['value']==1){echo ' checked="checked"';} ?> type="radio" value="1" name="WEB_SITE_CLOSE">开启</label>
							<label class="radio-inline"><input <?php if($site['WEB_SITE_CLOSE']['value']==0){echo ' checked="checked"';} ?> type="radio" value="0" name="WEB_SITE_CLOSE">关闭</label>
					</div>
				</div>
			</div>

			<div class="form-group">
				<label class="col-sm-2 control-label no-padding-left" style="visibility: hidden;">提交：</label>
				<div class="col-sm-10">
					<div class="clearfix">
						<button form="form" type="submit"   class="btn btn-sm btn-primary radius5">提交</button>
					</div>
				</div>
			</div>
		</form>
	</div>
</div>


</block>
<block name="javascript">
<script src="__PUBLIC__/fileupload/jquery.ui.widget.js"></script>
<script src="__PUBLIC__/fileupload/jquery.fileupload.js"></script>
<script>
$(function(){

	// tooltips on hover button-upload
	$('[data-toggle=\'tooltip\']').tooltip({container: 'body', html: true});

	// Makes tooltips work on ajax generated content
	$(document).ajaxStop(function() {
		$('[data-toggle=\'tooltip\']').tooltip({container: 'body'});
	});



	$(document).delegate('a[data-toggle=\'image\']', 'click', function(e) {
		e.preventDefault();

		var index=$(this).attr('num');

		//alert(index);

		var element = this;

		if(index==undefined){
			$(element).popover({
				html: true,
				placement: 'right',
				trigger: 'manual',
				content: function() {
					return '<button type="button" id="thumb-image"  class="btn btn-primary"><i class="icon-edit"></i></button> <button type="button" id="button-clear" class="btn btn-danger"><i class="icon-trash"></i></button>';
				}
			});
		}



		$(element).popover('toggle');

		//商品图片
		$('#thumb-image').on('click', function() {

			//alert('333');

			$('#modal-image').remove();

			$('#form-upload').remove();

			$('body').prepend('<form enctype="multipart/form-data" id="form-upload" style="display: none;"><input osctype="btn_upload_image" type="file" name="file" /></form>');

			$('#form-upload input[name=\'file\']').trigger('click');

			$(element).popover('hide');

			$('[osctype="btn_upload_image"]').fileupload({

	        	dataType: 'json',
	            url: "{:U('Image/upload_image',array('dir'=>'shop'))}",
	            add: function(e, data) {
	                $parent = $('#thumb');
	                $input = $parent.find('[osctype="image_input"]');
	                $img = $parent.find('[osctype="image"]');
	                data.formData = {old_goods_image:$input.val()};
	                $img.attr('src', "__IMG__/loading.gif");
	                data.submit();
	            },
	            done: function (e,data) {

	            	var image=data.result;

	                $parent = $('#thumb');
	                $input = $parent.find('[osctype="image_input"]');
	                $img = $parent.find('[osctype="image"]');
	                if(image) {
	                   // $img.prev('i').hide();
	                    $img.attr('src', '__ROOT__'+image.image_thumb);
	                    $img.show();
	                    $input.val(image.image);
	                } else {
	                    alert('上传失败');
	                }
	            }
   		 });
		});




		$('#button-clear').on('click', function() {
			$(element).find('img').attr('src', $(element).find('img').attr('data-placeholder'));

			$(element).parent().find('input').attr('value', '');

			$(element).popover('hide');
		});
	});
});

</script>
</block>